############## EXERCICE PROG PAPIER ##############

t = [[1,1,0,0],[1,0,0,0],[0,0,0,0],[0,0,0,0]]
def mystere():
    for i in range(2):
        for j in range(2):
            t[i+2][j+2]=t[i][j]
    affiche_matrice(t)

def mystere2():
    for i in range(2):
        for j in range(2):
            t[3-i][3-j]=t[i][j]
    affiche_matrice(t)



############## EXERCICE PROG ORDI ################

tab=[[0,0,1,1],[0,1,0,0],[1,0,0,0],[1,0,0,0]]
#tab=[[1,1,1,1],[0,1,0,1],[1,0,0,1],[1,0,0,0]]

def initmat(val , colonne,ligne):
    return [[val for col in range(colonne)] for lig in range(ligne)]

            
def affiche_matrice(Mat):
    for i in range(len(Mat)):
        for j in range(len(Mat)):
            print Mat[i][j],
        print "\n"
        

def remplis(tab):
    m2=initmat(0,8,8)
    for i in range(len(tab)):
        for j in range(len(tab[i])):
            m2[i][j]=tab[i][j]
    affiche_matrice(m2)
    return m2

def sym1(tab):
    for i in range(len(tab)//2):
        for j in range(len(tab[i])//2):
            tab[i][len(tab[i])-1-j]=tab[i][j]
    affiche_matrice(tab)

def sym2(tab):
    for i in range(len(tab)//2):
        for j in range(len(tab[i])):
            tab[len(tab)-1-i][j]=tab[i][j]
    affiche_matrice(tab)

def sym3(tab):
    for i in range(len(tab)):
        for j in range(len(tab[i])//2):
            tab[i][j+len(tab)//2]=tab[i][j]
    affiche_matrice(m2)

def compte(tab):
    compteur=0
    for i in range(len(tab)):
        for j in range(len(tab[i])):
            if tab[i][j]==1:
                compteur= compteur+1
    print "Il y a : "+str(compteur)
        
